package lc_剑指_Offer_II_092_翻转字符;

public class Solution {
	public int minFlipsMonoIncr(String s) {
		int a = 0, b = 0;
		for (int i = 0; i < s.length(); i++) {
			char c = s.charAt(i);
			if (c == '0') {
				b = Math.min(a, b) + 1;
			} else {
				b = Math.min(a, b);
				a = a + 1;
			}
		}
		return Math.min(a, b);
	}
}